#include<iostream>
#define ll long long
using namespace std;

//费马小定理：对任意素数p和与其互质的整数a，a^p-1 = 1 (mod p)
//二次探测定理：对于质数p，若x^2 = 1 (mod p) ，则小于p的解只会有两个：x1 = 1,x2 = p - 1;
//令n-1=2^t * u，其中u是奇数，t是正整数。n-1的二进制表示是奇数u的二进制表示后面加t个0。
//优化：在int范围中可以选择{2,7,61}这三个数保证正确，在longlong范围中选择
//{ 2, 325, 9375, 28178, 450775, 9780504, 1795265022 }这7个数保证正确。

ll quick_pow(ll a, ll b, ll mod)
{
    ll res = 1;
    a = a % mod;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod, b >>= 1;
    }
    return res;
}

bool miller_rabin(ll n)
{
    if (n <= 1) return 0;
    if (n == 2 || n == 3) return 1;
    if (n % 2 == 0) return 0;
    ll a[12] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 };
    for (ll i = 0;i < 12 && a[i] < n;i++) {
        ll u = n - 1, t = 0;
        while ((u & 1) == 0) u = u >> 1, t++;
        ll x1 = quick_pow(a[i], u, n), x2;
        for (ll i = 0;i < t;i++) {
            x2 = quick_pow(x1, 2, n);
            if (x2 == 1 && x1 != 1 && x1 != n - 1) return 0;
            x1 = x2;
        }
        if (x1 != 1) return 0;
    }
    return 1;
}

int main()
{
    int n, x;
    while (cin >> n) {
        int cnt = 0;
        for (int i = 1;i <= n;i++) {
            cin >> x;
            cnt += miller_rabin(x);
        }
        cout << cnt << '\n';
    }
}